<template>
    <div>
      <el-breadcrumb :separator-icon="ArrowRight">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>考勤报表</el-breadcrumb-item>
      <el-breadcrumb-item>考勤记录</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="record">
      <div class="block">
       &emsp; <span>查询：</span> 
        <el-date-picker
          v-model="value1"
          type="date"
          placeholder="Pick a Date"
          format="YYYY/MM/DD"
          value-format="YYYY-MM-DD"
          @change="find()"
        />
      </div>
      <div class="an">   <el-input
        v-model="input2"
        class="w-50 m-2"
        placeholder="请选择部门"
        :prefix-icon="Search"
        @change="bumen"
      /></div>
   
      <div class="an">   <el-input
        v-model="input"
        class="w-50 m-2"
        placeholder="请选择员工"
        :prefix-icon="Search"
        @change="yuangong"
      /></div>
   
  <div class="an"> 
      <el-select @change="jia" v-model="form.region" placeholder="加班类型">
        <el-option label="工作日加班" value="工作日加班" />
        <el-option label="休息日加班" value="休息日加班" />
        <el-option label="节假日加班" value="节假日加班" />
      </el-select>
    </div>
     
    <div class="an"> 
      <el-select @change="ban" v-model="form1.region" placeholder="补偿方式">
        <el-option label="加班工资" value="加班工资" />
        <el-option label="加班调休" value="加班调休" />
     
      </el-select>
    </div>
    </div>
  
    <div class="table">
      <div class="biao"> <span>加班记录</span></div>
    <el-table :data="tableData" size="large " border style="width: 100%" fit>
      <el-table-column label="序号" type="index"/>
      <el-table-column prop="name" label="姓名" width="180" />
      <el-table-column prop="department" label="部门" width="180" />
      <el-table-column prop="check" label="加班类型" />
      <el-table-column prop="date" label="补偿方式" />
      <el-table-column prop="qq" label="加班日期" />
   
      <el-table-column prop="location" label="加班地点" />
     
    </el-table>
  
    </div>
    </div> 
  </template>
  
  <script setup>
  import { ArrowRight } from '@element-plus/icons-vue'
  import * as service from '@/api/wenbo/wenbo'
  import { ref,onMounted } from 'vue'
  import { Calendar, Search } from '@element-plus/icons-vue'
  
  let form = ref({region:''})
  let form1 = ref({region:''})
  let tableData = ref([])
  const value1 = ref('')
  let input = ref('')
  let input2 = ref('')
  let find = async() => {
    console.log(value1.value);
    let res = await service.form1({qq_like:value1.value})
    tableData.value = res.data
  }
  


  onMounted( async ()=>{
    let res = await service.form1()
    console.log(res);
    tableData.value = res.data
  })


  let bumen = async () => {
    let res = await service.form1({department_like:input2.value})
    tableData.value = res.data
    
  }
  let yuangong = async () => {
    let res = await service.form1({name_like:input.value})
    tableData.value = res.data
    
  }

  let jia = async () => {
    console.log(form.value.region);
    let res = await service.form1({check_like:form.value.region})
    tableData.value = res.data
  }

  let ban = async () => {
    console.log(form.value.region);
    let res = await service.form1({date_like:form1.value.region})
    tableData.value = res.data
  }
  </script >
  
  <style lang="scss" scoped>
  .record{
    width: 100%;
    height: 80px;
    background: #eee;
    margin:20px auto;
    display: flex;
    align-items: center;
    .an{
      margin-left: 20px;
    }
    
  }
  .table{
    width: 95%;
    height: 100%;
    margin: 0 auto;
    .biao{
      width: 100%;
      height: 60px;
      background: #eee;
      margin: 20px auto;
      font-size: 21px;
      line-height: 60px;
      text-indent: 30px
    }
  }
  
  
  
  
  
  
  
  
  
  .demo-date-picker {
    display: flex;
    width: 100%;
    padding: 0;
    flex-wrap: wrap;
  }
  .demo-date-picker .block {
    padding: 30px 0;
    text-align: center;
    border-right: solid 1px var(--el-border-color);
    flex: 1;
  }
  .demo-date-picker .block:last-child {
    border-right: none;
  }
  .demo-date-picker .demonstration {
    display: block;
    color: var(--el-text-color-secondary);
    font-size: 14px;
    margin-bottom: 20px;
  }
  </style>